#ifndef TRIGGERSTAB_H
#define TRIGGERSTAB_H

#include <QWidget>
#include <QtGui>
#include "aed_archtype.h"
#include "triggerscriptmodel.h"
#include "triggerconditionmodel.h"
#include "comboboxdelegate.h"
#include "scriptmodel.h"

class TriggersTab : public QWidget
{
    Q_OBJECT
    AED_Archtype *m_arch;
    TriggerScriptModel* m_scriptmodel;
    QListView *m_scriptview;
    TriggerConditionModel *m_conditionmodel;
    QTableView *m_condview;
    QComboBox *typebox;
    QComboBox *namebox;
    ComboBoxDelegate *m_delegate;
    ScriptModel *m_parentscriptmodel;
    QPushButton *m_removetrigger;
    QPushButton *m_addtrigger;
    QHBoxLayout *m_warnbox;
    QLabel* m_warning;

public:
    explicit TriggersTab(AED_Archtype* arch, ScriptModel *scriptm, QWidget *parent = 0);
    void setArchtype(AED_Archtype* arch);
signals:

public slots:
    void UpdateTypes(int tab);
    void UpdateNames(const QString &type);
    void UpdateConditions(QModelIndex index, QModelIndex unused);
    void UpdateConditions(QModelIndex index);

    //void AddTrigger(); // Ha d'arreplegar info del combobox d'scripts.
    void RemoveTrigger();
    void AddCondition();
    void RemoveCondition();

    void LoadScript();
    void CheckScripts();
    void PopulateScripts();
};

#endif // TRIGGERSTAB_H
